package com.xbts.screen.monitor.domain.token;

import org.springframework.util.StringUtils;

/**
 * 授权类型
 */
public enum GrantType {
  /** 密码认证鉴权 */
  password,
  /** 客户端认证鉴权 */
  client_credentials,
  /** 只刷新token使用 */
  refresh_token;

  public static GrantType getGrantType(String grantTypeName){
      if(StringUtils.isEmpty(grantTypeName)){
          return null;
      }
      for(GrantType grantType : GrantType.values()){
          if(grantTypeName.equals(grantType.name())){
              return grantType;
          }
      }
      return null;
  }
}
